ListNode* reverseBetween(ListNode* head, int m, int n) 
{
	if (head == nullptr || head->next == nullptr || m == n) return head;
	ListNode newnode(0);
	newnode.next = head;
	ListNode* tail = &newnode;
	for (int i = 0; i < m - 1; i++) tail = tail->next;
	ListNode* cur = tail->next;
	for (int i = 0; i < n - m; i++)
	{
	    ListNode* next = cur->next;
	    cur->next = next->next;
	    next->next = tail->next;
	    tail->next = next;
	}
	return newnode.next;
}